package com.iwith.dongmoon.util;

import android.content.Context;
import android.widget.Toast;

import com.google.gson.Gson;
import com.iwith.dongmoon.gsonlist.BizList;
import com.iwith.dongmoon.gsonlist.BoardList;
import com.iwith.dongmoon.gsonlist.CategoryList;
import com.iwith.dongmoon.gsonlist.MemberList;
import com.iwith.dongmoon.gsonlist.PictureList;

public class RequestGson {
	public BoardList getBoardGsonBySendingAPI(Context mContext,	String api_name, String api_type, String param) {
		Gson gson = new Gson();
		RequestData data = new RequestData(mContext, api_name, api_type, param);
		String result = data.getDataGet();
		BoardList boardList = gson.fromJson(result, BoardList.class);

		return boardList;
	}

	public MemberList getMemberGsonBySendingAPI(Context mContext, String api_name, String api_type, String param) {
		Gson gson = new Gson();
		RequestData data = new RequestData(mContext, api_name, api_type, param);
		String result = data.getDataGet();
		MemberList memberList = gson.fromJson(result, MemberList.class);

		return memberList;
	}

	public BizList getBizGsonBySendingAPI(Context mContext, String api_name, String api_type, String param) {
		Gson gson = new Gson();
		RequestData data = new RequestData(mContext, api_name, api_type, param);
		String result = data.getDataGet();
		BizList bizList = gson.fromJson(result, BizList.class);

		return bizList;

	}
	
	public CategoryList getCategoryGsonBySendingAPI(Context mContext,
			String api_name, String param) {
		Gson gson = new Gson();
		RequestData data = new RequestData(mContext, api_name, "", param);
		String result = data.getDataGet();
		CategoryList categoryList = gson.fromJson(result, CategoryList.class);

		return categoryList;
	}
	
	public PictureList getPictureGsonBySendingAPI(Context mContext,
			String api_name, String api_type, String param) {
		Gson gson = new Gson();
		RequestData data = new RequestData(mContext, api_name, api_type, param);
		String result = data.getDataGet();
		PictureList pictureList = gson.fromJson(result, PictureList.class);

		return pictureList;
	}
	
	public void alertToast(Context mContext, String message) {
		Toast alertMessage = Toast.makeText(mContext, message,
				Toast.LENGTH_SHORT);
		alertMessage.show();
	}
}
